<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<link	href="css/style.css" rel="stylesheet" type="text/css" />
<link  href="admin/css/jsDatePick_ltr.min.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />
<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="js/accouting.js"></script>
<script type="text/javascript" src="admin/css/jsDatePick.min.1.3.js"></script>
<script type="text/javascript" src="js/jquery.price_format.1.7.js"></script>
<script type="text/javascript" src="js/jquery.price_format.1.7.min.js"></script>
<?php
include "generallibraries/funcs2.php";
$group_assets = mysql_query("SELECT g.*,(SELECT SUM(a.count+a.notuse+a.stock) FROM assets a WHERE a.group=g.id ) as count FROM group_assets g ORDER BY g.name;");
$groupassets = array();
while ($r = mysql_fetch_array($group_assets)) {
    $groupassets[] = array($r['id'], $r['name'], $r['count']);
}

if (isset($_SESSION['groupAssets2'])) {
    $groupAssets1 = $_SESSION['groupAssets2'];
}else
    $groupAssets1=0;

$assets = mysql_query("SELECT a.*,t.name  as nametype,e.FullName  FROM assets a, type_assets t,employee e WHERE a.`group` ='" . $groupAssets1 . "' AND a.type=t.id AND a.creater=e.IDEmployee ORDER BY t.`name`,a.`name`");
$isBorrow = array();
while ($r = mysql_fetch_array($assets)) {
    $isBorrow[] = array($r['id'], $r['name'], $r['count'], $r['notuse'], $r['stock'], $r['nametype'], $r['note'], $r['FullName'], $r['datetime'], $r['type'], $r['value'], $r['place']);
}

$type_assets = mysql_query("SELECT t.*,(SELECT COUNT(*) FROM assets a WHERE a.type=t.id ) as count FROM type_assets t ORDER BY t.name;");
$typeassets = array();
while ($r = mysql_fetch_array($type_assets)) {
    $typeassets[] = array($r['id'], $r['name'], $r['count']);
}

$borrow_assets = mysql_query("SELECT b.*,e.FullName,a.`name` FROM borrow_assets b LEFT JOIN employee e ON b.idemployee=e.IDEmployee, assets a WHERE b.count!=0 AND b.id_assets=a.id;");
$notBorrow = array();
while ($r = mysql_fetch_array($borrow_assets)) {
    $notBorrow[] = array($r['id'], $r['id_assets'], $r['count'], $r['total'], $r['FullName'], $r['datetime'], $r['note'], $r['name']);
}


$query_de = mysql_query("select department.IDDepartment, department_lang.DepartmentName from department, department_lang where department.IDDepartment = department_lang.IDDepartment and department_lang.LangID='" . $lang . "'");
$mangkq = array();
while ($row = mysql_fetch_array($query_de)) {
    $query11 = mysql_query("SELECT IDEmployee,FullName  FROM employee where State!=0 AND IDRole!=1 AND IDRole!=3 and IDDepartment='" . $row[0] . "'");
    $mangone = array();
    while ($row1 = mysql_fetch_array($query11)) {
        $mangone[] = $row1;
    }
    $mangkq[$row[1]] = $mangone;
}
$bien = generalFunctions::xuatds($mangkq, 'employeeisCheck', $l_all);
$queryDepartment = mysql_query("SELECT d.IDDepartment,dl.DepartmentName FROM department d,department_lang dl WHERE d.IDDepartment=dl.IDDepartment AND dl.LangID='$lang';");
$querySendMail = mysql_query("SELECT e.IDEmployee,e.FullName FROM list_sendmailassets l,employee e WHERE  e.IDEmployee=l.employee_id GROUP BY l.employee_id");

include 'popup/popup_addgroupassets.php';
include 'popup/popup_addtypeassets.php';
include 'popup/popup_editgroupassets.php';
include 'popup/popup_edittypeassets.php';
include 'popup/popup_delgroupassets.php';
include 'popup/popup_deltypeassets.php';
include 'popup/popup_editassets.php';
include 'popup/popup_moveassets.php';
include 'popup/popup_sendmailAssets.php';
include 'popup/popup_memoassets.php';
?>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.price_format.1.7.js"></script>
<script type="text/javascript" src="js/jquery.price_format.1.7.min.js"></script>
<link rel="stylesheet" type="text/css" href="admin/css/jsDatePick_ltr.min.css" />
<script type="text/javascript" src="admin/css/jsDatePick.min.1.3.js"></script>
<link	href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />
<script src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
<script language="javascript" src="js/cal2.js"></script>


<link href="css/css/style.css" rel="stylesheet" type="text/css" />

<style type="text/css">
.content_menu_expand{
	position:absolute; 
	right:-5px;
	top:20px;
	z-index:999;
	background-color: #ffffff;
	-moz-border-radius: 7px;
	-webkit-border-radius: 7px;
	color: #000000;
	width:190px;
	max-height:180px;
	overflow:auto;
}

.passul{padding-left:0; border:1px solid black}
.bgkhac {background: #eee;}
.passul ul{padding:0px;}
.passul ul li {color:#474747; font-size:12px;padding: 5px 0;padding-left:5px;list-style: none;text-decoration: none;}
.passul ul li:hover { background: #0A246A;color:white;text-decoration: none;list-style: none;}
</style>
<script type="text/javascript">
    <!--
    $(document).ready(function() {
        $('#valueAssets').priceFormat({
            prefix: '',
            centsLimit: 0,
            centsSeparator: '',
            thousandsSeparator: ','
        });
        LoadPlace();
    });
    $(function() {
    	
        var tabs = $( "#tabs" ).tabs();
        tabs.find( ".ui-tabs-nav" ).sortable({
            axis: "x",
            stop: function() {
                tabs.tabs( "refresh" );
            }
        });
    });
    function onLoad(){
        var tabs = $( "#tabs" ).tabs();
        tabs.find( ".ui-tabs-nav" ).sortable({
            axis: "x",
            stop: function() {
                tabs.tabs( "refresh" );
            }
        });
    }
    function LoadPlace(){
    	//placeAssets
		$("#placeAssets").autocomplete("operations/rpc_assets_place.php", {
			selectFirst: true	
		});
		$('#content_menu_expand1').hide();
		$(document).click(function() {
			$("#content_menu_expand1").hide();
		});
		$('#content_menu_expand1').click(function(e) {
			e.stopPropagation();
		});
		$('#menu_expand1').click(function(event) {
			if ($('#content_menu_expand1').is(":hidden")) {
				$('#content_menu_expand1').show();
			}
			else
				$('#content_menu_expand1').hide();
			return false;
		});
    }
    function clickCustomer1(gt){
    	document.getElementById("placeAssets").value=gt;
    	$('#content_menu_expand1').hide();
    }
    function showsearchAssets(groupAssets,status){
        var body = document.getElementById('frmsearchAssets');
        body.setAttribute('style','opacity:.5; position:relative;cursor: wait;  ');
	
        var d=document.createElement('div');
        d.setAttribute('style','display: block;visibility: visible; position: absolute;  z-index: 999; top: 0px; left: 0px; width: 105%; height: 105%; text-align: center;  filter: alpha(opacity=5); opacity: 0.5; ');
	
        var image=document.createElement('img');
        image.setAttribute('src','images/loading1.gif');
        image.setAttribute('style','position:absolute; left:0px; top:0px; right:0; bottom:0; margin:auto');
	
        d.appendChild(image);
	
        body.appendChild(d);	
	
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmsearchAssets").innerHTML=xmlhttp.responseText;
                document.getElementById('frmsearchAssets').setAttribute('style','opacity:1; position:relative;');
                onLoad();
            }
        }
        xmlhttp.open("GET","content_assets/showsearchAssets.php?groupAssets="+encodeURIComponent(groupAssets)+"&status="+status,true);
        xmlhttp.send();
    }
    function searchAssets(){
        var groupAssets=document.getElementById('sgroupAssets').value;
        var typeAssets=document.getElementById('stypeAssets').value;
        var nameAssets=document.getElementById('snameAssets').value;
        var using=1;
        var stock=1;
        var notuse=1;
	
        var gt1=document.getElementById("using").checked;
        if(gt1==false)
            using=0;

        var gt2=document.getElementById("stock").checked;
        if(gt2==false)
            stock=0;

        var gt3=document.getElementById("notuse").checked;
        if(gt3==false)
            notuse=0;	

        var body = document.getElementById('frmsearchAssets');
        body.setAttribute('style','opacity:.5; position:relative;cursor: wait;  ');
	
        var d=document.createElement('div');
        d.setAttribute('style','display: block;visibility: visible; position: absolute;  z-index: 999; top: 0px; left: 0px; width: 105%; height: 105%; text-align: center;  filter: alpha(opacity=5); opacity: 0.5; ');
	
        var image=document.createElement('img');
        image.setAttribute('src','images/loading1.gif');
        image.setAttribute('style','position:absolute; left:0px; top:0px; right:0; bottom:0; margin:auto');
	
        d.appendChild(image);
	
        body.appendChild(d);	
	
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmsearchAssets").innerHTML=xmlhttp.responseText;
                document.getElementById('frmsearchAssets').setAttribute('style','opacity:1; position:relative;');
                onLoad();
            }
        }
        xmlhttp.open("GET","content_assets/searchAssets.php?groupAssets="+groupAssets+"&typeAssets="+typeAssets+"&nameAssets="+encodeURIComponent(nameAssets)+"&using="+using+"&stock="+stock+"&notuse="+notuse,true);
        xmlhttp.send();

    }
    function checkonlytypeassets(tenid,field){
        var body = document.getElementById('frmisCheck');
        body.setAttribute('style','display:none;');
        if(document.getElementById(tenid).checked == true){
            for(var i = 0;i<field.length;i++)
            {
                field[i].checked = false ;
            }
            document.getElementById(tenid).checked = true;
            var id=document.getElementById(tenid).value;
            //alert(id);
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    document.getElementById("groupassets").innerHTML=xmlhttp.responseText;
                    onLoad();
                }
            }
            xmlhttp.open("GET","content_assets/loadgroupassets.php?id="+id,true);
            xmlhttp.send();
		
        }else{
            document.getElementById(tenid).checked=false;
		
        }
    }
    function LoadnotCheckSearch(idtype){
        //alert(idtype);
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                onLoad();
                document.getElementById("LoadnotCheckSearch").innerHTML=xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","content_assets/LoadnotCheckSearch.php?idtype="+idtype,true);
        xmlhttp.send();
    }
    function checkonlysis(id_assets){
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer  
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmeditassets").innerHTML=xmlhttp.responseText;
                onLoad();
                $('#valueAssets1').priceFormat({
                    prefix: '',
                    centsLimit: 0,
                    centsSeparator: '',
                    thousandsSeparator: ','
                });
                popup_window_show('#sample5', { pos : 'window-center', width : '530px', height:'800px'});

                var t = document.getElementById('memoAssets1');
            	var offset= !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width'))) ;
            	
            	t.style.height = 'auto';
            	if((t.scrollHeight  + offset )>80)
            		t.style.height = (t.scrollHeight  + offset ) + 'px';  
            	else
            		t.style.height = '80px';  
            }
        }
        xmlhttp.open("GET","content_assets/loadisCheck.php?id_assets="+id_assets,true);
        xmlhttp.send();
	
    }
    function checkonlyis(id_assets){
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer  
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmeditassets").innerHTML=xmlhttp.responseText;
                onLoad();
                $('#valueAssets1').priceFormat({
                    prefix: '',
                    centsLimit: 0,
                    centsSeparator: '',
                    thousandsSeparator: ','
                });
                popup_window_show('#sample5', { pos : 'window-center', width : '530px', height:'800px'});

                var t = document.getElementById('memoAssets1');
            	var offset= !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width'))) ;
            	
            	t.style.height = 'auto';
            	if((t.scrollHeight  + offset )>80)
            		t.style.height = (t.scrollHeight  + offset ) + 'px';  
            	else
            		t.style.height = '80px';  
            }
        }
        xmlhttp.open("GET","content_assets/loadisCheck.php?id_assets="+id_assets,true);
        xmlhttp.send();
	
    }
    function moveAssets(){
        var nameAssets=document.getElementById('nameAssets2').value;
        var countAssets=document.getElementById('countAssets2').value;
        var notuseAssets=document.getElementById('notuseAssets2').value;
        var stockAssets=document.getElementById('stockAssets2').value;
        var idAssets=document.getElementById('idAssets2').value;

        var typeAssets=document.getElementById('typeAssets2').value;
        var groupAssets=document.getElementById('groupAssets2').value;
	
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
												 
                if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                }else{// code for IE6, IE5
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange=function(){
                    if (xmlhttp.readyState==4 && xmlhttp.status==200){
                        document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
                        alert('<?= $l_movesuccessfull ?>');
                        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                            xmlhttp=new XMLHttpRequest();
                        }else{// code for IE6, IE5
                            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        xmlhttp.onreadystatechange=function(){
                            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                document.getElementById("frmsearchAssets").innerHTML=xmlhttp.responseText;
                                onLoad();
                            }
                        }
                        xmlhttp.open("GET","content_assets/loadsearchAssets.php",true);
                        xmlhttp.send();
                    }
                }
                xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                xmlhttp.send();
												  
            }
        }
        xmlhttp.open("GET","content_assets/moveAssets.php?idAssets="+idAssets+"&nameAssets="+encodeURIComponent(nameAssets)+"&countAssets="+countAssets+"&notuseAssets="+notuseAssets+"&stockAssets="+stockAssets+"&typeAssets="+typeAssets+"&groupAssets="+groupAssets,true);
        xmlhttp.send();
    }
    function showmoveAssets(id_assets){
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer  
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmmoveassets").innerHTML=xmlhttp.responseText;
                onLoad();
                popup_window_show('#sample8', { pos : 'window-center', width : '320px', height:'800px'});
            }
        }
        xmlhttp.open("GET","content_assets/frmmoveassets.php?id_assets="+id_assets,true);
        xmlhttp.send();
	
    }
    function showmemoAssets(id_assets,name_assets,ele){
        //$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        //$('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer  
        document.getElementById("tilte").innerHTML=name_assets;
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
            	popup_window_show('#sample10', { pos : 'tag-bottom-left', parent : ele, width : '450px', height:'800px'});
                document.getElementById("frmmemoassets").innerHTML=xmlhttp.responseText;
                
                var t = document.getElementById('textarea1');
            	var offset= !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width'))) ;
            	
            	//t.style.height = 'auto';
            	if((t.scrollHeight  + offset )>44)
            		t.style.height = (t.scrollHeight  + offset ) + 'px';  
            	else
            		t.style.height = '44px';  
                
            }
        }
        xmlhttp.open("GET","content_assets/frmmemoassets.php?id_assets="+id_assets,true);
        xmlhttp.send();
	
    }
    function checkonlyis1(tenid,field){

        if(document.getElementById(tenid).checked == true){
            for(var i = 0;i<field.length;i++)
            {
                field[i].checked = false ;
            }
            document.getElementById(tenid).checked = true;
            var id_assets=document.getElementById(tenid).value;
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    document.getElementById("frmisCheck").innerHTML=xmlhttp.responseText;
                    onLoad();
                    var body = document.getElementById('frmisCheck');
                    body.setAttribute('style','display:block;');
                }
            }
            xmlhttp.open("GET","content_assets/loadisCheck.php?id_assets="+id_assets,true);
            xmlhttp.send();
		
        }else{
            document.getElementById(tenid).checked=false;
            var body = document.getElementById('frmisCheck');
            body.setAttribute('style','display:none;');
        }
	
    }

    function checkonlynot(tenid,field){

        if(document.getElementById(tenid).checked == true){
            for(var i = 0;i<field.length;i++)
            {
                field[i].checked = false ;
            }
            document.getElementById(tenid).checked = true;
            var id_borrow_assets=document.getElementById(tenid).value;
		
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    document.getElementById("frmnotCheck").innerHTML=xmlhttp.responseText;
                    onLoad();
                    var body = document.getElementById('frmnotCheck');
                    body.setAttribute('style','display:block;');
                }
            }
            xmlhttp.open("GET","content_assets/loadnotCheck.php?id_borrow_assets="+id_borrow_assets,true);
            xmlhttp.send();
		
        }else{
            document.getElementById(tenid).checked=false;
            var body = document.getElementById('frmnotCheck');
            body.setAttribute('style','display:none;');
        }
	
    }

    function isCheck(){
        var employeeisCheck=document.getElementById('employeeisCheck').value;
        var idisCheck=document.getElementById('idisCheck').value;
        var countisCheck=document.getElementById('countisCheck').value;
        var noteisCheck=document.getElementById('noteisCheck').value;
        //alert(employeeisCheck+"  "+idisCheck+"  "+countisCheck+"   "+noteisCheck);
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                window.location.assign("manage_assets.php")
            }
        }
        xmlhttp.open("GET","content_assets/isCheck.php?employeeisCheck="+employeeisCheck+"&idisCheck="+idisCheck+"&countisCheck="+countisCheck+"&noteisCheck="+encodeURIComponent(noteisCheck),true);
        xmlhttp.send();
    }
    function notCheck(){
	
        var idnotCheck=document.getElementById('idnotCheck').value;
        var countnotCheck=document.getElementById('countnotCheck').value;
        var notenotCheck=document.getElementById('notenotCheck').value;
        var idisCheck=document.getElementById('idisCheck1').value;
        //alert(idnotCheck+"  "+countnotCheck+"  "+notenotCheck+"  "+idisCheck);
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                // alert(xmlhttp.responseText);
                window.location.assign("manage_assets.php")
            }
        }
        xmlhttp.open("GET","content_assets/notCheck.php?idnotCheck="+idnotCheck+"&idisCheck="+idisCheck+"&countnotCheck="+countnotCheck+"&notenotCheck="+encodeURIComponent(notenotCheck),true);
        xmlhttp.send();
    }
    function isNumberKey(evt)
    {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
        return true;
    }
    function LoadfrmsgroupAssets(){
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmsgroupAssets").innerHTML=xmlhttp.responseText;
                onLoad();
            }
        }
        xmlhttp.open("GET","content_assets/LoadfrmsgroupAssets.php",true);
        xmlhttp.send();
    }
    function LoadfrmstypeAssets(){
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmstypeAssets").innerHTML=xmlhttp.responseText;
                onLoad();
            }
        }
        xmlhttp.open("GET","content_assets/LoadfrmstypeAssets.php",true);
        xmlhttp.send();
    }
    function editgroupAssets(){
        var idgroupAssets=document.getElementById('ideditgroupAssets').value;
        var groupAssets=document.getElementById('editgroupAssets').value;

        if(groupAssets==""){
            alert('<?= $l_errorassets3 ?>');
        }else {
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    alert('<?= $l_fix_complete ?>');
                    document.getElementById("trgroupassets").innerHTML=xmlhttp.responseText;
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            document.getElementById("frmisCheck").setAttribute('style','display:none;');
                            document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
                            onLoad();
                            LoadfrmsgroupAssets();
                        }
                    }
                    xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                    xmlhttp.send();
												
                }
            }
            xmlhttp.open("GET","content_assets/editgroupAssets.php?groupAssets="+encodeURIComponent(groupAssets)+"&idgroupAssets="+idgroupAssets,true);
            xmlhttp.send();
        }


    }
    function edittypeAssets(){
        var idtypeAssets=document.getElementById('idedittypeAssets').value;
        var typeAssets=document.getElementById('edittypeAssets').value;

        if(typeAssets==""){
            alert('<?= $l_errorassets2 ?>');
        }else {
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    alert('<?= $l_fix_complete ?>');
                    onLoad();
                    document.getElementById("trtypeassets").innerHTML=xmlhttp.responseText;
                    LoadfrmstypeAssets();
                }
            }
            xmlhttp.open("GET","content_assets/edittypeAssets.php?typeAssets="+encodeURIComponent(typeAssets)+"&idtypeAssets="+idtypeAssets,true);
            xmlhttp.send();
        }

    }
    function showeditgroupassets(){
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer  
        var groupAssets=document.getElementById('groupAssets').value;
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmeditgroupassets").innerHTML=xmlhttp.responseText;
                onLoad();
                popup_window_show('#sample3', { pos : 'window-center', width : '320px', height:'800px'});
            }
        }
        xmlhttp.open("GET","content_assets/frmeditgroupassets.php?groupAssets="+groupAssets,true);
        xmlhttp.send();
	
    }
    function showedittypeassets(){
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer  
        var typeAssets=document.getElementById('typeAssets').value;
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmedittypeassets").innerHTML=xmlhttp.responseText;
                onLoad();
                popup_window_show('#sample4', { pos : 'window-center', width : '320px', height:'800px'});
            }
        }
        xmlhttp.open("GET","content_assets/frmedittypeassets.php?typeAssets="+typeAssets,true);
        xmlhttp.send();
    }
    function delgroupsAssets(){
        var count=document.getElementById("countdelgroup").value;
        if(count>1){
            var hoi= confirm("<?php echo $l_areyousure; ?>");
            if (hoi==true) {
                var str="";
                for(var i=1;i<count;i++){
                    if(document.getElementById('checkdelgroup'+i).checked==true)
                        str+='_'+document.getElementById('checkdelgroup'+i).value;
                }
                if(str!=""){
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            document.getElementById("trgroupassets").innerHTML=xmlhttp.responseText;
                            // var kq=document.getElementById("kqgroupAssets").value;
															
														  
														 
                            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                                xmlhttp=new XMLHttpRequest();
                            }else{// code for IE6, IE5
                                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                            }
                            xmlhttp.onreadystatechange=function(){
                                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                    document.getElementById("frmisCheck").setAttribute('style','display:none;');
                                    document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
                                    LoadfrmsgroupAssets();
                                    onLoad();
                                }
                            }
                            xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                            xmlhttp.send();
                        }
                    }
                    xmlhttp.open("GET","content_assets/delgroupsAssets.php?groupAssets="+str,true);
                    xmlhttp.send();
				
                }else
                    alert("No check");
            }
        }else{
            alert('No data');
        }
    }
    function deltypesAssets(){
        var count=document.getElementById("countdeltype").value;
        if(count>1){
            var hoi= confirm("<?php echo $l_areyousure; ?>");
            if (hoi==true) {
                var str="";
                for(var i=1;i<count;i++){
                    if(document.getElementById('checkdeltype'+i).checked==true)
                        str+='_'+document.getElementById('checkdeltype'+i).value;
                }
                if(str!=""){
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            document.getElementById("trtypeassets").innerHTML=xmlhttp.responseText;
                            //var kq=document.getElementById("kqtypeAssets").value;
                            onLoad();
                            LoadfrmstypeAssets();
														  
														  
														  
														  
                        }
                    }
                    xmlhttp.open("GET","content_assets/deltypesAssets.php?typeAssets="+str,true);
                    xmlhttp.send();
				
                }else
                    alert("No check");
            }
        }else{
            alert('No data');
        }
    }
    function showdelgroupAssets(){
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer 
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmdelgroupassets").innerHTML=xmlhttp.responseText;
                onLoad();
                popup_window_show('#sample6', { pos : 'window-center', width : '320px', height:'800px'});
            }
        }
        xmlhttp.open("GET","content_assets/frmdelgroupassets.php",true);
        xmlhttp.send();
	
    }
    function showdeltypeAssets(){
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer       

        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmdeltypeassets").innerHTML=xmlhttp.responseText;
                onLoad();
                popup_window_show('#sample7', { pos : 'window-center', width : '320px', height:'800px'});
            }
        }
        xmlhttp.open("GET","content_assets/frmdeltypeassets.php",true);
        xmlhttp.send();
    }
    function delgroupAssets(){
        var hoi= confirm("<?php echo $l_areyousure; ?>");
        if (hoi==true) {
            var groupAssets=document.getElementById('groupAssets').value;
	
	
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    document.getElementById("trgroupassets").innerHTML=xmlhttp.responseText;
                    var kq=document.getElementById("kqgroupAssets").value;
                    if(kq==1)
                        alert('<?= $l_xoakhongthanhcong ?>');
                    else{
                        alert('<?= $l_xoathanhcong ?>');
                    }
													 
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            document.getElementById("frmisCheck").setAttribute('style','display:none;');
                            document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
                            LoadfrmsgroupAssets();
                            onLoad();
                        }
                    }
                    xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                    xmlhttp.send();
                }
            }
            xmlhttp.open("GET","content_assets/delgroupAssets.php?groupAssets="+groupAssets,true);
            xmlhttp.send();
		
        }
    }
    function deltypeAssets(){
        var hoi= confirm("<?php echo $l_areyousure; ?>");
        if (hoi==true) {
            var typeAssets=document.getElementById('typeAssets').value;
		
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    document.getElementById("trtypeassets").innerHTML=xmlhttp.responseText;
                    var kq=document.getElementById("kqtypeAssets").value;
                    LoadfrmstypeAssets();
                    if(kq==1)
                        alert('<?= $l_xoakhongthanhcong ?>');
                    else{
                        alert('<?= $l_xoathanhcong ?>');
                    }
                    onLoad();
													  
                }
            }
            xmlhttp.open("GET","content_assets/deltypeAssets.php?typeAssets="+typeAssets,true);
            xmlhttp.send();
		
        }
    }

    function savegroupAssets(){
	
        var groupAssets=document.getElementById('addgroupAssets').value;
	
        if(groupAssets==""){
            alert('<?= $l_errorassets3 ?>');
        }else {
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    document.getElementById("trgroupassets").innerHTML=xmlhttp.responseText;
                    var kq=document.getElementById("kqgroupAssets").value;
                    if(kq==1){
                        alert('<?= $l_themthanhcong ?>');
                        document.getElementById('addgroupAssets').value="";
                    }else
                        alert('Existed');
													 
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            document.getElementById("frmisCheck").setAttribute('style','display:none;');
                            document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
                            LoadfrmsgroupAssets();
                            onLoad();
																								  
                        }
                    }
                    xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                    xmlhttp.send();
														  
													  
                }
            }
            xmlhttp.open("GET","content_assets/savegroupAssets.php?groupAssets="+encodeURIComponent(groupAssets),true);
            xmlhttp.send();
        }

	
    }
    function savetypeAssets(){
        var typeAssets=document.getElementById('addtypeAssets').value;
	
        if(typeAssets==""){
            alert('<?= $l_errorassets2 ?>');
        }else {
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    document.getElementById("trtypeassets").innerHTML=xmlhttp.responseText;
                    var kq=document.getElementById("kqtypeAssets").value;
                    LoadfrmstypeAssets();
                    if(kq==1){
                        alert('<?= $l_themthanhcong ?>');
                        document.getElementById('addtypeAssets').value="";
                    }else
                        alert('Existed');
                    onLoad();
													  
                }
            }
            xmlhttp.open("GET","content_assets/savetypeAssets.php?typeAssets="+encodeURIComponent(typeAssets),true);
            xmlhttp.send();
        }
	
    }
    function saveAssets(){
	
        var groupAssets=document.getElementById('groupAssets').value;
        var typeAssets=document.getElementById('typeAssets').value;
        var nameAssets=document.getElementById('nameAssets').value;
	
        var countAssets=document.getElementById('countAssets').value;
        var notuseAssets=document.getElementById('notuseAssets').value;
        var stockAssets=document.getElementById('stockAssets').value;

        var valueAssets=document.getElementById('valueAssets').value;
        var placeAssets=document.getElementById('placeAssets').value;
        
        var noteAssets=document.getElementById('noteAssets').value;
        var memoAssets=document.getElementById('memoAssets').value;
	
        if(nameAssets==""){
            alert('<?= $l_errorassets1 ?>');
            //}else if(countAssets==0 && notuseAssets==0 && stockAssets==0 ){
            //alert('<?= $l_errorassets4 ?>');
        }else {
            document.getElementById('btnsave').disabled=true;
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    var kq=xmlhttp.responseText;
                    if(kq==1){
                        alert('Existed');
                        document.getElementById('btnsave').disabled=false;
                    }else{
                        alert('<?= $l_themthanhcong ?>');
                        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                            xmlhttp=new XMLHttpRequest();
                        }else{// code for IE6, IE5
                            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        xmlhttp.onreadystatechange=function(){
                            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                document.getElementById('btnsave').disabled=false;
                                document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
                                //document.getElementById('groupAssets').value=0;
                                //document.getElementById('typeAssets').value=0;
                                document.getElementById('nameAssets').value="";
																									
                                document.getElementById('countAssets').value=0;
                                document.getElementById('notuseAssets').value=0;
                                document.getElementById('stockAssets').value=0;

                                document.getElementById('valueAssets').value=0;
                                document.getElementById('placeAssets').value="";
                                
                                document.getElementById('noteAssets').value="";
                                document.getElementById('memoAssets').value="";
                                onLoad();
                            }
                        }
                        xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php?groupAssets="+groupAssets,true);
                        xmlhttp.send();
                    }
                }
            }
            xmlhttp.open("GET","content_assets/saveAssets.php?groupAssets="+groupAssets+"&typeAssets="+typeAssets+"&nameAssets="+encodeURIComponent(nameAssets)+"&countAssets="+countAssets+"&notuseAssets="+notuseAssets+"&stockAssets="+stockAssets+"&valueAssets="+valueAssets+"&placeAssets="+encodeURIComponent(placeAssets)+"&noteAssets="+encodeURIComponent(noteAssets)+"&memoAssets="+encodeURIComponent(memoAssets),true);
            xmlhttp.send();
        }
    }
    function frmChecknot1(){
        var idassets=document.getElementById('nameAssets1').value;
        var idtype=document.getElementById('groupAssets1').value;
	
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("frmChecknot").innerHTML=xmlhttp.responseText;
                onLoad();
            }
        }
        xmlhttp.open("GET","content_assets/frmChecknot.php?idassets="+idassets+"&idtype="+idtype,true);
        xmlhttp.send();
    }

    function deletesAssets(count){
        if(count>0){
            var hoi= confirm("<?php echo $l_areyousure; ?>");
            if (hoi==true) {
                var str="";
                for(var i=1;i<=count;i++){
                    if(document.getElementById('checksis'+i).checked==true)
                        str+='_'+document.getElementById('checksis'+i).value;
                }
                if(str!=""){
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            //window.location.assign("manage_assets.php")
                            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                                xmlhttp=new XMLHttpRequest();
                            }else{// code for IE6, IE5
                                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                            }
                            xmlhttp.onreadystatechange=function(){
                                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                    document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
																									  
                                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                                        xmlhttp=new XMLHttpRequest();
                                    }else{// code for IE6, IE5
                                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                                    }
                                    xmlhttp.onreadystatechange=function(){
                                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                            document.getElementById("frmsearchAssets").innerHTML=xmlhttp.responseText;
                                            onLoad();
                                        }
                                    }
                                    xmlhttp.open("GET","content_assets/loadsearchAssets.php",true);
                                    xmlhttp.send();
                                }
                            }
                            xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                            xmlhttp.send();
													    	
                        }
                    }
                    xmlhttp.open("GET","content_assets/deleteAssets.php?idAssets="+str,true);
                    xmlhttp.send();
                }else{
                    alert("No check");
                }
            }
        }else{
            alert('No data');
        }
    }

    function deleteAssets(count){
        if(count>0){
            var hoi= confirm("<?php echo $l_areyousure; ?>");
            if (hoi==true) {
                var str="";
                for(var i=0;i<count;i++){
                    if(document.getElementById('checkis'+i).checked==true)
                        str+='_'+document.getElementById('checkis'+i).value;
                }
                if(str!=""){
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            //window.location.assign("manage_assets.php")
                            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                                xmlhttp=new XMLHttpRequest();
                            }else{// code for IE6, IE5
                                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                            }
                            xmlhttp.onreadystatechange=function(){
                                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                    document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
																									  
																									  
                                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                                        xmlhttp=new XMLHttpRequest();
                                    }else{// code for IE6, IE5
                                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                                    }
                                    xmlhttp.onreadystatechange=function(){
                                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                            document.getElementById("frmsearchAssets").innerHTML=xmlhttp.responseText;
                                            onLoad();
                                        }
                                    }
                                    xmlhttp.open("GET","content_assets/loadsearchAssets.php",true);
                                    xmlhttp.send();
                                }
                            }
                            xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                            xmlhttp.send();
													    	
                        }
                    }
                    xmlhttp.open("GET","content_assets/deleteAssets.php?idAssets="+str,true);
                    xmlhttp.send();
                }else{
                    alert("No check");
                }
            }
        }else{
            alert('No data');
        }
    }
    function deleteAssets1(idAssets){
        var hoi= confirm("<?php echo $l_areyousure; ?>");
        if (hoi==true) {
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    var groupAssets=document.getElementById('idisCheck1').value;
                    //window.location.assign("manage_assets.php")
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            document.getElementById("frmisCheck").setAttribute('style','display:none;');
                            document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
																							  
                            onLoad();
                        }
                    }
                    xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php?groupAssets="+groupAssets,true);
                    xmlhttp.send();
											    	
                }
            }
            xmlhttp.open("GET","content_assets/deleteAssets.php?idAssets="+idAssets,true);
            xmlhttp.send();
        }
    }

    function updateAssets(){
        var nameAssets=document.getElementById('nameAssets1').value;
        var countAssets=document.getElementById('countAssets1').value;
        var notuseAssets=document.getElementById('notuseAssets1').value;
        var stockAssets=document.getElementById('stockAssets1').value;

        var valueAssets=document.getElementById('valueAssets1').value;
        var placeAssets=document.getElementById('placeAssets1').value;
        
        var noteAssets=document.getElementById('noteAssets1').value;
        var memoAssets=document.getElementById('memoAssets1').value;
        var idAssets=document.getElementById('idAssets1').value;

        var typeAssets=document.getElementById('typeAssets1').value;
        var groupAssets=document.getElementById('groupAssets1').value;

        var idtypeAssets=document.getElementById('idtypeAssets1').value;
        var idgroupAssets=document.getElementById('idgroupAssets1').value;

        //if(countAssets==0 && notuseAssets==0 && stockAssets==0 ){
        //    alert('<?= $l_errorassets4 ?>');
        //}else{

	
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    //alert(xmlhttp.responseText);
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
                            alert('<?= $l_fix_complete ?>');
                            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                                xmlhttp=new XMLHttpRequest();
                            }else{// code for IE6, IE5
                                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                            }
                            xmlhttp.onreadystatechange=function(){
                                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                    document.getElementById("frmsearchAssets").innerHTML=xmlhttp.responseText;
                                    onLoad();
                                }
                            }
                            xmlhttp.open("GET","content_assets/loadsearchAssets.php",true);
                            xmlhttp.send();
                        }
                    }
                    xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                    xmlhttp.send();
												  
                }
            }
            xmlhttp.open("GET","content_assets/updateAssets.php?idAssets="+idAssets+"&nameAssets="+encodeURIComponent(nameAssets)+"&countAssets="+countAssets+"&notuseAssets="+notuseAssets+"&stockAssets="+stockAssets+"&valueAssets="+valueAssets+"&placeAssets="+encodeURIComponent(placeAssets)+"&noteAssets="+encodeURIComponent(noteAssets)+"&memoAssets="+encodeURIComponent(memoAssets)+"&typeAssets="+typeAssets+"&groupAssets="+groupAssets+"&idtypeAssets="+idtypeAssets+"&idgroupAssets="+idgroupAssets,true);
            xmlhttp.send();
        //}
    }
    function deletegroupAssets(idtypeAssets){
        var hoi= confirm("<?php echo $l_areyousure; ?>");
        if (hoi==true) {
            //alert(idtypeAssets);
            if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }else{// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function(){
                if (xmlhttp.readyState==4 && xmlhttp.status==200){
                    //alert(xmlhttp.responseText);
                    if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }else{// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function(){
                        if (xmlhttp.readyState==4 && xmlhttp.status==200){
                            document.getElementById("frmisCheck").setAttribute('style','display:none;');
                            document.getElementById("frmlistCheckis").innerHTML=xmlhttp.responseText;
                            onLoad();
                        }
                    }
                    xmlhttp.open("GET","content_assets/loadfrmlistCheckis.php",true);
                    xmlhttp.send();
											    	
                }
            }
            xmlhttp.open("GET","content_assets/deletegroupAssets.php?idtypeAssets="+idtypeAssets,true);
            xmlhttp.send();
        }
	

        /**/
    }
    function showsendmailAssets(){
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer       

	
        popup_window_show('#sample9', { pos : 'window-center', width : '600px', height:'800px'});
										
	
    }
    function showUser1(str){
        if (str==""){
            document.getElementById("txtHint").innerHTML="";
            return;
        } 
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
                onLoad();
            }
        }
        xmlhttp.open("GET","ajax/getuser1.php?q="+str,true);
        xmlhttp.send();
    }
    function showReference1(str){ 
        if (str==""){
            document.getElementById("txtHint1").innerHTML="";
            return;
        } 
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("txtHint1").innerHTML=xmlhttp.responseText;
                onLoad();
            }
        }
        xmlhttp.open("GET","ajax/getreference3.php?idemployee="+str,true);
        xmlhttp.send();
    }
    function rmReference1(str){ 
        if (str==""){
            document.getElementById("txtHint1").innerHTML="";
            return;
        } 
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                document.getElementById("txtHint1").innerHTML=xmlhttp.responseText;
                onLoad();
            }
        }
        xmlhttp.open("GET","ajax/rmreference3.php?idemployee="+str,true);
        xmlhttp.send();
    }
    function sendmail(){
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                //document.getElementById('showview').setAttribute('style','opacity:1; position:relative;');
                alert("Update Send mail successful");
                onLoad();
            }
        }
        xmlhttp.open("GET","content_assets/sendmail.php",true);
	
        xmlhttp.send();
    }
    /*$(document).ready(function(){
        $("#groupAssets").autocomplete("operations/rpc_search_groupAssets.php", {
                selectFirst: true
        });
        $('#content_menu_expand').hide();
        $(document).click(function() {
                $("#content_menu_expand").hide();
        });
        $('#content_menu_expand').click(function(e) {
                e.stopPropagation();
        });

        $('#menu_expand').click(function() {
                if ($('#content_menu_expand').is(":hidden")) {
                        //var gt=document.getElementById("checkkhung").checked;
                        //if(gt==false){
                                $('#content_menu_expand').show();
                                $('#content_menu_expand1').hide();
                        //}
                }
                else {
                        $('#content_menu_expand').hide();
                }
                return false;
        });


        $("#typeAssets").autocomplete("operations/rpc_search_typeAssets.php", {
                selectFirst: true
        });
        $('#content_menu_expand1').hide();
        $(document).click(function() {
                $("#content_menu_expand1").hide();
        });
        $('#content_menu_expand1').click(function(e) {
                e.stopPropagation();
        });

        $('#menu_expand1').click(function() {
                if ($('#content_menu_expand1').is(":hidden")) {
                        //var gt=document.getElementById("checkkhung").checked;
                        //if(gt==false){
                                $('#content_menu_expand1').show();
                                $('#content_menu_expand').hide();
                        //}
                }
                else {
                        $('#content_menu_expand1').hide();
                }
                return false;
        });

});

function clickCustomer(gt){
        document.getElementById("groupAssets").value=gt;
        $('#content_menu_expand').hide();
}
function clickCustomer1(gt){
        document.getElementById("typeAssets").value=gt;
        $('#content_menu_expand1').hide();
}*/
    function enterTable(e,value,co){
        var key = window.event ? e.keyCode : e.which;

        if (key == 13 || key == 8 || key == 46  || key == 37 || key == 39 || key == 45 || co == '0') {
            if(key==13){
                var i = 0;
                var j = 0;
                var listID = new Array();
		
                listID = listID.concat(["groupAssets","typeAssets","nameAssets","countAssets","notuseAssets","stockAssets","valueAssets","placeAssets","noteAssets","memoAssets"]);	

                for (j = 0; j < listID.length; j++){	
                    if (listID[j] == value) {	
                        if (j == listID.length - 1) {
                            return false;
                        }
                        document.getElementById(listID[j + 1]).focus();
                        document.getElementById(listID[j + 1]).select();
                        return false; 
                    }
                }
			
                return false;
            }else
                return true;	
        } else if ( key < 48 || key > 57 ) {
            return false;
        }
        else return true;
				
    }
    //-->
</script>


<div id="contains" style="height:100%;">
    <div class="title" style="padding-top: 5px;font-weight: bold;"><?= $l_manage_assets ?></div>
    <div class="content_code" style="height:100%;">
        <div class="approval-right" style="padding-right:10px; height:100%;">
            <div id="tabs">
                <ul style="padding-left:0">
                    <li class="tabpc" style="background: url(images/tabpc.png) no-repeat;"><a href="#tabs-1" id="tab1" onclick="document.getElementById('tab1').setAttribute('style','color:blue;');document.getElementById('tab2').setAttribute('style','color:white;');" style="color: blue;"><?php echo $l_addassets; ?></a></li>
                    <li class="taban" style="background: url(images/tabpc.png) no-repeat;"><a href="#tabs-2" id="tab2" onclick="document.getElementById('tab2').setAttribute('style','color:blue;');document.getElementById('tab1').setAttribute('style','color:white;');"><?php echo $l_searchassets; ?></a></li>
                </ul>
                <div class="clear"></div>
                <div id="tabs-1">
                    <?php echo $l_addassets; ?><br>
                    <div  style="width:100%;border: 1px solid silver;  " >
                        <table style="width:100%; padding: 10px 0 0 10px;">

                            <tr id="trgroupassets">
                                <td class="tdfirst"><?php echo $l_groupassets; ?></td>
                                <td style="width: 100px">
                                    <select name="groupAssets" id="groupAssets" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
                                        <?php
                                        $i = 0;
                                        foreach ($groupassets as $value => $giatri) {
                                            ?>
                                            <option value="<?php echo $giatri[0]; ?>" ><?php echo $giatri[1]; ?></option>
                                            <?php
                                            $i++;
                                        }
                                        ?>
                                    </select>
                                    <!--  <div style="float:left">
                                                    <input type="text" size="30" name="groupAssets" id="groupAssets" value="<?php /* echo $groupassets[0][1]; */ ?>" onkeypress="return enterTable(event,this.id,'0')"  style="width: 185px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
                                                    
											<div class="suggestionsBox" id="suggestions" style="display:none;">
                                                            <img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
                                                            <img alt="" src="images/arrow-down.png" id="menu_expand" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand" class="passul content_menu_expand" style="display:none">
											        <ul>
                                    <?php
                                    $i = 0;
                                    foreach ($groupassets as $value => $giatri) {
                                        ?>
    															<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer('<?= $giatri[1] ?>')" 
                                        <?php
                                        if ($i % 2 != 0) {
                                            ?>
        																		class="bgkhac"
                                            <?php
                                        }
                                        ?>
    															> <?php echo $giatri[1]; ?></li>
                                        <?php
                                        $i++;
                                    }
                                    ?>
											        </ul>
											    </div>
											</div>	 -->


                                </td>
                                <td>
                                    <?php if (count($groupassets) > 0) { ?>
                                        <a style="padding-left: 5px;" onclick="showdelgroupAssets()"><img src="images/del.png"  title="<?php echo $l_delgroupassets; ?>" /></a>
                                        <a style="padding-left: 5px;" onclick="showeditgroupassets()"><img src="images/editn.png"  title="<?php echo $l_editgroupassets; ?>" /></a>
<?php } ?>
                                    <a style="padding-left: 5px;" onclick="popup_window_show('#sample1', { pos : 'window-center', width : '320px', height:'800px'});"><img src="images/plus.png"  title="<?php echo $l_addgroupassets; ?>" /></a>
                                </td>
                            </tr>
                            <tr id="trtypeassets">
                                <td  class="tdfirst"><?php echo $l_typeassets; ?></td>
                                <td style="width: 100px">
                                    <select name="typeAssets" id="typeAssets" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
<?php
$i = 0;
foreach ($typeassets as $value => $giatri) {
    ?>
                                            <option value="<?php echo $giatri[0]; ?>" ><?php echo $giatri[1]; ?></option>
                                            <?php
                                            $i++;
                                        }
                                        ?>
                                    </select>
                                    <!-- <div style="float:left">
                                                    <input type="text" size="30" name="typeAssets" id="typeAssets" value="<?php /* echo $typeassets[0][1]; */ ?>" onkeypress="return enterTable(event,this.id,'0')"  style="width: 185px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
                                                    
											<div class="suggestionsBox" id="suggestions" style="display:none;">
                                                            <img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
                                                            <img alt="" src="images/arrow-down.png" id="menu_expand1" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand1" class="passul content_menu_expand" style="display:none">
											        <ul>
                                    <?php
                                    $i = 0;
                                    foreach ($typeassets as $value => $giatri) {
                                        ?>
    															<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer1('<?= $giatri[1] ?>')" 
                                        <?php
                                        if ($i % 2 != 0) {
                                            ?>
        																		class="bgkhac"
                                            <?php
                                        }
                                        ?>
    															> <?php echo $giatri[1]; ?></li>
                                        <?php
                                        $i++;
                                    }
                                    ?>
											        </ul>
											    </div>
											</div>	 -->


                                </td>
                                <td>
                                    <?php if (count($typeassets)) { ?>
                                        <a style="padding-left: 5px;" onclick="showdeltypeAssets()"><img src="images/del.png"  title="<?php echo $l_deltypeassets; ?>" /></a>
                                        <a style="padding-left: 5px;" onclick="showedittypeassets()"><img src="images/editn.png"  title="<?php echo $l_edittypeassets; ?>" /></a>
                                    <?php } ?>
                                    <a style="padding-left: 5px;" onclick="popup_window_show('#sample2', { pos : 'window-center', width : '320px', height:'800px'});"><img src="images/plus.png"  title="<?php echo $l_addtypeassets; ?>" /></a>
                                </td>
                            </tr>
                            <tr>
                                <td  class="tdfirst"><?php echo $l_nameassets; ?></td>
                                <td style="width: 100px"><input type="text" id="nameAssets" name="nameAssets" value="" onkeypress="return enterTable(event,this.id,'0')" class="in_testfield" style="width:185px;float:left;height:24px;"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td  class="tdfirst"><?= $l_using ?></td>
                                <td style="width: 100px"><input type="text" id="countAssets" name="countAssets" value="0" onkeypress="return enterTable(event,this.id,'1')" onKeyPress="return isNumberKey(event)" class="in_testfield" style="width:85px;height:24px;text-align: right;"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td  class="tdfirst"><?= $l_notused ?></td>
                                <td style="width: 100px"><input type="text" id="notuseAssets" name="notuseAssets" value="0" onkeypress="return enterTable(event,this.id,'1')" onKeyPress="return isNumberKey(event)" class="in_testfield" style="width:85px;height:24px;text-align: right;"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td  class="tdfirst"><?= $l_stock ?></td>
                                <td style="width: 100px"><input type="text" id="stockAssets" name="stockAssets" value="0" onkeypress="return enterTable(event,this.id,'1')" onKeyPress="return isNumberKey(event)" class="in_testfield" style="width:85px;height:24px;text-align: right;"/></td>
                                <td></td>
                            </tr>
                            
                            <tr>
                                <td  class="tdfirst"><?= $l_value ?></td>
                                <td style="width: 100px"><input type="text" id="valueAssets" name="valueAssets" value="0" onkeypress="return enterTable(event,this.id,'1')" onKeyPress="return isNumberKey(event)" class="in_testfield" style="width:185px;height:24px;text-align: right;"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td  class="tdfirst"><?=$l_place ?></td>
                                <td colspan="2" style="width: 100px">
                                
                                <!-- <input type="text" id="placeAssets" name="placeAssets"   class="in_testfield" style="width:400px;height:24px;"/>-->
                                	<div style="float:left">
											<input type="text" size="30" name="placeAssets" id="placeAssets" onkeypress="return enterTable(event,this.id,'0')" value="<?=$nameCompany?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand1" >
											    <div id="content_menu_expand1" class="passul content_menu_expand" style="display: none" >
											        <ul style="height: auto;border-bottom: none;">
											        <?php 
											        
											    		$sql="select name from assets_place";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row5=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer1('<?=$row5['name']?>')"	
																<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																style="margin-left: auto;float: initial;padding: 7px 3px;width: auto;text-align: left;height: auto;"> <?php echo $row5['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                
                                </td>
                                
                            </tr>
                            
                            <tr>
                                <td  class="tdfirst"><?= $l_note ?></td>
                                <td colspan="2" style="width: 100px"><input type="text" id="noteAssets" name="noteAssets"  onkeypress="return enterTable(event,this.id,'0')"  class="in_testfield" style="width:400px;height:24px;"/></td>

                            </tr>
                            <tr>
                                <td  class="tdfirst"><?=$l_memo?></td>
                                <td colspan="2" style="width: 100px">
                                	<textarea id="memoAssets" name="memoAssets"    class="in_testfield" style="width:396px;height:80px;"></textarea>
                                </td>
                            </tr>
                            <!--  <tr>
                                    <td  class="tdfirst"><?php echo $l_status; ?></td>
                                    <td style="width: 260px">
                                            <select id="statusAssets" name="statusAssets" style="width:185px;float:left;height:24px;" onkeypress="return enterTable(event,this.id,'0')">
                                            
						           		<option value="0"><?php echo $l_used; ?></option>
						           		<option value="1"><?php echo $l_notused; ?></option>
                                    
									</select>
								</td>
                                    <td></td>
							</tr>-->
                            <tr>
                                <td colspan="2" style="text-align: center;">
                                    <input style="margin:2px 5px 0 0; font-size: 12px;" type="button" id="btnsave" value="<?= $l_save ?>" onclick="saveAssets()"  class="btn_choose"  /></td>
                                <td></td>
                            </tr>

                        </table>
                    </div>
                    <input style="margin:2px 5px 0 0; font-size: 12px;" type="button" value="<?= $l_sendmail ?>" onclick="showsendmailAssets()"  class="btn_choose"  />
                    <br><br>


<?php echo $l_listassets; ?><br>
                    <div  style="width:100%;border: 1px solid silver; min-height: 350px;" >
                        <form action="" method="get" id="frmCheckis" name="frmCheckis">
                            <div style="min-height: 220px;" id="frmlistCheckis">
                                <table cellpadding="0" cellspacing="1" border="0" class="ftable1" style="padding: 0 20px 0 10px; float: left;margin-top: 0px;">
                                    <tr>
                                        <th style="width: 30px"><?= $l_no ?></th>
                                        <th style="width: 30px">
                                            <!--  <button type="submit" name="Delete" style="border: 0; background: transparent">
                                                                <img src="images/del.png"  />
								</button>-->
                                        </th>
                        <!--<th style="width: 30px">
				            	  <button type="submit" name="Delete" style="border: 0; background: transparent">
                                            <img src="images/del.png"  />
								</button>
								</th>-->
                                        <th style="width: 200px"><?php echo $l_groupassets; ?></th>
                                        <th style="width: 30px"><?php echo $l_total; ?></th>
                                        <!--  <th style="width: 35px"><?php echo $l_status; ?></th>-->
                                    </tr>
                                            <?php
                                            $i = 0;
                                            foreach ($groupassets as $value => $giatri) {
                                                ?>
                                        <tr>
                                            <td><?= $i + 1 ?></td>
                                            <!--  <td>
                                            <?php if ($giatri[2] == 0) { ?>
        								    <a onclick="deletegroupAssets('<?= $giatri[0] ?>')"><img src="images/del.png"  title="<?php echo $l_delete; ?>" /></a>
    <?php } ?>
    								</td>-->
                                            <td><input type="checkbox" name="checktypeassets" id="<?php echo 'checktypeassets' . $i ?>" onclick="checkonlytypeassets(this.id,document.frmCheckis.checktypeassets);" <?php if ($groupAssets1 == $giatri[0])
        echo 'checked="checked"'; ?>   value="<?= $giatri[0] ?>" /></td>
                                            <td style="text-align: left;padding-left: 10px;"><?php echo $giatri[1]; ?></td>
                                            <td style="text-align: left;padding-left: 10px;"><?php echo $giatri[2]; ?></td>
                                            <!--  <td style="text-align: left;padding-left: 10px;"><?php if ($giatri[3] != "")
                                        if ($giatri[3] != 0)
                                            echo '<img src="images/star.png"  title="' . $l_used . '" />'; ?></td>-->
                                        </tr>
    <?php
    $i++;
}
?>	
                                </table>
                                <div id="groupassets" >
                                    <table cellpadding="0" cellspacing="1" border="0" class="ftable1" style="padding-left: 10px">
                                        <tr>
                                            <th style="width: 30px"><?= $l_no ?></th>
                                            <th style="width: 30px">
                                                <a onclick="deleteAssets(<?= count($isBorrow) ?>)"><img src="images/del.png"  title="<?php echo $l_delete; ?>" /></a>
                                            </th>
                                            <th style="width: 170px"><?php echo $l_nameassets; ?></th>
                                            
                                            <th style="width: 60px"><?php echo $l_total; ?></th>
                                            <th style="width: 60px"><?php echo $l_using; ?></th>
                                            <th style="width: 60px"><?php echo $l_notused; ?></th>
                                            <th style="width: 60px"><?php echo $l_stock; ?></th>
                                            <th style="width: 130px"><?php echo $l_value; ?></th>
                                			<th style="width: 220px"><?php echo $l_place; ?></th>
                                            <th style="width: 140px"><?php echo $l_note; ?></th>
                                            <th style="width: 20px"><?php echo $l_memo; ?></th>
                                            <th style="width: 140px"><?php echo $l_author; ?></th>
                                            <th style="width: 140px"><?php echo $l_time; ?></th>
                                            <th style="width: 20px"><?php echo $l_move; ?></th>

                                        </tr>
<?php
$i = 0;
$temp = "";
foreach ($isBorrow as $value => $giatri) {
    if ($giatri[5] != $temp) {
        $result = mysql_query("SELECT SUM(a.count) as sumcount,SUM(a.notuse) as sumnotuse,SUM(a.stock) as sumstock FROM assets a WHERE a.type='" . $giatri[9] . "' AND a.`group`='" . $groupAssets1 . "';");
        $temp = $giatri[5];
        $r = mysql_fetch_assoc($result);
        $tong = $r['sumcount'] + $r['sumnotuse'] + $r['sumstock'];
        echo '<tr>
				            					<td colspan="3" style="font-weight:bold;height:30px;text-align:left;padding-left:20px;background: #B1BBBB">' . $giatri[5] . ' (' . $tong . ')</td>
				            					<td colspan="11" style="font-weight:bold;height:30px;text-align:left;padding-left:10px;background: #B1BBBB">' . $l_using . '(' . $r['sumcount'] . ') - ' . $l_notused . '(' . $r['sumnotuse'] . ') - ' . $l_stock . '(' . $r['sumstock'] . ')</td>
				            			</tr>';
    }
    ?>
                                            <tr>

                                                <td><?= $i + 1 ?></td>
                                                <td><?php //if($giatri[2]>0){?><input type="checkbox" name="<?php echo 'checkis' . $i ?>" id="<?php echo 'checkis' . $i ?>"  value="<?= $giatri[0] ?>"><?php //}?></td>
                                                <td style="padding-left: 5px;text-align: left;"><a onclick="checkonlyis('<?= $giatri[0] ?>');" ><?php echo $giatri[1]; ?></a></td>
                                                
                                                <td style="font-weight: bold;background: #B0D9FF"><?php echo $giatri[2] + $giatri[3] + $giatri[4]; ?></td>
                                                <td><?php echo $giatri[2]; ?></td>
                                                <td style='background: #FF9999'><?php echo $giatri[3]; ?></td>
                                                <td><?php echo $giatri[4]; ?></td>
                                                
                                                <td style="text-align: right;padding-right: 5px"><?php echo number_format($giatri[10]); ?></td>
                                                <td style="text-align: left;padding-left: 5px"><?php echo $giatri[11]; ?></td>
                                                
                                                <td style="text-align: left;padding-left: 5px"><?php echo $giatri[6]; ?></td>
                                                <td><a onclick="showmemoAssets('<?= $giatri[0] ?>','<?= $giatri[1] ?>',this)"><img src="images/attibutes.png"  title="<?php echo $l_memo; ?>" /></a></td>
                                                <td><?php echo $giatri[7]; ?></td>
                                                <td><?php echo $giatri[8]; ?></td>
                                                <td><a onclick="showmoveAssets('<?= $giatri[0] ?>')"><img src="images/communication.png"  title="<?php echo $l_move; ?>" /></a></td>
                                            </tr>
    <?php
    $i++;
}
if ($i == 0) {
    ?>
                                            <tr><td colspan="14" style="height:30px;text-align:left;padding-left:20px;background: #D0D8E8"><?php echo $l_list_emplty; ?></td></tr>
<?php } ?>
                                    </table>
                                </div>
                            </div>
                            <br>
                            <div id="frmisCheck" style="display: none">
                                <input type="hidden" value="1" name="idisCheck" id="idisCheck">
                                <table style=" padding-left:10px;">

                                    <tr >
                                        <td  class="tdfirst" style="width: 180px"><?php echo $l_nameassets; ?></td>
                                        <td>
                                            <input type="text" name="nameisCheck" id="nameisCheck"  class="in_testfield" style="width:200px;float:left;height:24px;" disabled="disabled" />
                                        </td>
                                        <td ></td>
                                        <td></td>
                                    </tr >			
                                    <tr >
                                        <td  class="tdfirst" style="width: 180px"><?php echo $l_countassets1 . '/' . $l_totalassets1; ?></td>
                                        <td>
                                            <select name="countisCheck" id="countisCheck" style="height: 24px">
                                                <option value="1">1</option>
                                            </select>/
                                            <select name="totalisCheck" id="totalisCheck" style="height: 24px" disabled="disabled">		
                                                <option value="4" selected="selected">4</option>
                                            </select>
                                        </td>
                                        <td></td>
                                        <td></td>
                                    </tr >
                                    <tr >
                                        <td  class="tdfirst" style="width: 180px"><?= $l_employee ?></td>
                                        <td style="width: 180px">
<?php echo $bien ?>
                                        </td>
                                        <td></td>
                                        <td></td>
                                    </tr >
                                    <tr >
                                        <td  class="tdfirst" style="height:24px;"><?= $l_note ?></td>
                                        <td><input type="text" name="noteisCheck" id="noteisCheck"  class="in_testfield" style="width:365px;float:left;height:24px;" /></td>
                                        <td><input style="margin:12px 5px 0 0; font-size: 12px;" type="button" value="<?= $l_xacnhan ?>" name="xacnhanis"   class="btn_choose"  /></td>
                                        <td></td>
                                    </tr>

                                </table>
                            </div>
                        </form>		

                    </div>
                    <br><br>
                    <!--  <?php echo $l_listassetsused; ?><br>
			<div  style="width:100%;border: 1px solid silver; padding: 0 0; " >
                    
                    <table  cellpadding="0" cellspacing="1" border="0" class="ftable1" style="padding-left: 10px">
                                                                                            
                    <tr height="40">
                    <td align="center" style="vertical-align:middle;width: 120px"><?php echo $l_groupassets; ?></td>
                    <td align="center" style="height:24px;width: 200px;">
                                                                    <select id="groupAssets1" name="groupAssets1" onchange="LoadnotCheckSearch(this.value)" style="width:185px;float:left;height:24px;" >
									<option value="0"><?php echo $l_all; ?></option>
<?php
$i = 0;
foreach ($groupassets as $value => $giatri) {
    ?>
    						           	<option value="<?php echo $giatri[0]; ?>"><?php echo $giatri[1]; ?></option>
                        <?php
                        $i++;
                    }
                    ?>	
									</select>
			</td >
                    <td align="center" style="vertical-align:middle;width: 120px"><?php echo $l_nameassets; ?></td>
                    <td align="center" style="height:24px;width: 200px;" id="LoadnotCheckSearch">
                                                                    <select id="nameAssets1" name="nameAssets1" style="width:185px;float:left;height:24px;">
			 						<option value="0"><?php echo $l_all; ?></option>
                    <?php
                    $i = 0;
                    foreach ($isBorrow as $value => $giatri) {
                        ?>
    						           	<option value="<?php echo $giatri[0]; ?>"><?php echo $giatri[1]; ?></option>
                        <?php
                        $i++;
                    }
                    ?>	
									</select>
			</td>	
                    <td><input style="margin:2px 5px 0 0; font-size: 12px;" type="button" value="<?= $l_search ?>" onclick="frmChecknot1();" class="btn_choose"  /></td>											
			</tr>
                    
			</table>
                    
				<form action="" method="get" id="frmChecknot" name="frmChecknot">
                            <table cellpadding="0" cellspacing="1" border="0" class="ftable1" style="padding-left: 10px">
                                        <tr>
                                            <th style="width: 30px"><?= $l_no ?></th>
                                            <th style="width: 30px">
								</th>
                                            <th style="width: 200px"><?php echo $l_nameassets; ?></th>
                                            <th style="width: 80px"><?php echo $l_countassets2; ?></th>
                                            <th style="width: 80px"><?php echo $l_totalassets2; ?></th>
                                            <th style="width: 200px"><?php echo $l_employee; ?></th>
                                            <th style="width: 200px"><?php echo $l_time; ?></th>
                                            <th style="width: 200px"><?php echo $l_note; ?></th>
                                            
				            </tr>
                    <?php
                    $i = 0;
                    foreach ($notBorrow as $value => $giatri) {
                        ?>
                                            <tr
    <?php
    if ($giatri[2] == $giatri[3])
        echo "style='background: rgb(139, 172, 241);'";
    else if ($giatri[2] < $giatri[3])
        echo "style='background: rgb(161, 191, 252);'";
    ?>
    				            >
                                                <td><?= $i + 1 ?></td>
                                                <td><input type="checkbox" name="checknot" id="<?php echo 'checknot' . $i ?>" onclick="checkonlynot(this.id,document.frmChecknot.checknot);"  value="<?= $giatri[0] ?>"></td>
                                                <td><?php echo $giatri[7]; ?></td>
                                                <td><?php echo $giatri[2]; ?></td>
                                                <td><?php echo $giatri[3]; ?></td>
                                                <td><?php echo $giatri[4]; ?></td>
                                                <td><?php echo $giatri[5]; ?></td>
                                                <td><?php echo $giatri[6]; ?></td>
    				            </tr>
                        <?php
                        $i++;
                    }
                    ?>	
			   </table>
			   <br>
			   <div id="frmnotCheck" style="display: none">
                       <input type="hidden" value="1" name="idnotCheck" id="idnotCheck">
                       <table style=" padding-left:10px;">

                                                    <tr >
                                                            <td  class="tdfirst" style="width: 180px"><?php echo $l_nameassets; ?></td>
                                                            <td>
                                                                    <input type="text" name="namenotCheck" id="namenotCheck"  class="in_testfield" style="width:200px;float:left;height:24px;" disabled="disabled" />
								</td>
                                                            <td ></td>
                                                            <td></td>
							</tr >		
                                                    <tr >
                                                            <td  class="tdfirst" style="width: 180px"><?php echo $l_employee; ?></td>
                                                            <td>
                                                                    <input type="text" name="employeenotCheck" id="employeenotCheck"  class="in_testfield" style="width:200px;float:left;height:24px;" disabled="disabled" />
								</td>
                                                            <td ></td>
                                                            <td></td>
							</tr >	
                                                    <tr >
                                                            <td  class="tdfirst" style="width: 180px"><?php echo $l_time; ?></td>
                                                            <td>
                                                                    <input type="text" name="datetimenotCheck" id="datetimenotCheck"  class="in_testfield" style="width:200px;float:left;height:24px;" disabled="disabled" />
								</td>
                                                            <td ></td>
                                                            <td></td>
							</tr >		
                                                    <tr >
                                                            <td  class="tdfirst" style="width: 180px"><?php echo $l_countassets2 . '/' . $l_totalassets2; ?></td>
                                                            <td>
                                                                    <select name="countnotCheck" id="countnotCheck" style="height: 24px">
										<option value="1">1</option>
									</select>/
                                                                    <select name="totalnotCheck" id="totalnotCheck" style="height: 24px" disabled="disabled">		
										<option value="4" selected="selected">4</option>
									</select>
								</td>
                                                            <td></td>
                                                            <td></td>
							</tr>
							<!--  <tr >
                                                            <td  class="tdfirst" style="width: 180px"><?= $l_employee ?></td>
                                                            <td style="width: 180px">
                    <?php echo $bien ?>
								</td>
                                                            <td></td>
                                                            <td></td>
							</tr >
                                                    <tr >
                                                            <td  class="tdfirst" style="height:24px;"><?= $l_note ?></td>
                                                            <td><input type="text" name="notenotCheck" id="notenotCheck"  class="in_testfield" style="width:365px;float:left;height:24px;" /></td>
                                                            <td><input style="margin:12px 5px 0 0; font-size: 12px;" type="button" value="<?= $l_xacnhan ?>" name="xacnhanis"   class="btn_choose"  /></td>
                                                            <td></td>
							</tr>
                                                    
				</table>
				</div>
				</form>		
                                    
			</div>-->
                </div>


                <div id="tabs-2">
                    <?php echo $l_searchassets; ?><br>
                    <div  style="width:100%;border: 1px solid silver;  " >
                        <table style="width:100%; padding: 10px 0 0 10px;">

                            <tr id="frmsgroupAssets">
                                <td class="tdfirst"><?php echo $l_groupassets; ?></td>
                                <td style="width: 100px">
                                    <select name="sgroupAssets" id="sgroupAssets" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
                                        <option value="0"><?php echo $l_all; ?></option>
                    <?php
                    $i = 0;
                    foreach ($groupassets as $value => $giatri) {
                        ?>
                                            <option value="<?php echo $giatri[0]; ?>"><?php echo $giatri[1]; ?></option>
    <?php
    $i++;
}
?>
                                    </select>
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr id="frmstypeAssets">
                                <td  class="tdfirst"><?php echo $l_typeassets; ?></td>
                                <td style="width: 100px">
                                    <select name="stypeAssets" id="stypeAssets" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
                                        <option value="0"><?php echo $l_all; ?></option>
                                        <?php
                                        $i = 0;
                                        foreach ($typeassets as $value => $giatri) {
                                            ?>
                                            <option value="<?php echo $giatri[0]; ?>"><?php echo $giatri[1]; ?></option>
                                            <?php
                                            $i++;
                                        }
                                        ?>
                                    </select>
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td  class="tdfirst"><?php echo $l_nameassets; ?></td>
                                <td style="width: 100px"><input type="text" id="snameAssets" name="snameAssets" value="" onkeypress="return enterTable(event,this.id,'0')" class="in_testfield" style="width:183px;float:left;height:24px;padding-left: 5px"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <label style="padding-left: 10px;"><input type="checkbox" id="using"><?= $l_using ?></label>
                                    <label style="padding-left: 10px;"><input type="checkbox" id="notuse"><?= $l_notused ?></label>
                                    <label style="padding-left: 10px;"><input type="checkbox" id="stock"><?= $l_stock ?></label>
                                </td>

                            </tr>

                            <tr>
                                <td colspan="2" style="text-align: center;">
                                    <input style="margin:2px 5px 0 0; font-size: 12px;" type="button" value="<?= $l_search ?>" onclick="searchAssets()"  class="btn_choose"  />
                                </td>
                                <td></td>
                            </tr>

                        </table>
                    </div>
                    <br>
<?php echo $l_resultsearchassets; ?><br>
                    <div  style="width:100%;border: 1px solid silver;" id="frmsearchAssets" >
                        <table cellpadding="0" cellspacing="1" border="0" class="ftable1" style="padding-left: 10px">
                            <tr>
                                <th style="width: 150px"><?php echo $l_groupassets; ?></th>
                                <th style="width: 150px"><?= $l_typeassets ?></th>
                                <th style="width: 30px"><?php echo $l_no; ?></th>
                                <th style="width: 200px"><?php echo $l_nameassets; ?></th>
                                
                                <th style="width: 60px"><?php echo $l_total; ?></th>
                                <th style="width: 60px"><?php echo $l_using; ?></th>
                                <th style="width: 60px"><?php echo $l_notused; ?></th>
                                <th style="width: 60px"><?php echo $l_stock; ?></th>
                                <th style="width: 130px"><?php echo $l_value; ?></th>
                                <th style="width: 220px"><?php echo $l_place; ?></th>
                                <th style="width: 140px"><?php echo $l_note; ?></th>
                                 <th style="width: 20px"><?php echo $l_memo; ?></th>
                                <th style="width: 140px"><?php echo $l_author; ?></th>
                                <th style="width: 140px"><?php echo $l_time; ?></th>
					
                            </tr>
                            <tr><td colspan="14" style="height:30px;text-align:left;padding-left:20px;"><?php echo $l_list_emplty; ?></td></tr>

                        </table>

                    </div>
                </div>

            </div>        
        </div>

    </div>


</div>
<?php mysql_close($connection); ?>